home *** CD-ROM | disk | FTP | other *** search
- Path: druid.borland.com!usenet
- From: pete@borland.com (Pete Becker)
- Newsgroups: comp.lang.c
- Subject: Re: free() wont free
- Date: 7 Mar 1996 16:48:46 GMT
- Organization: Borland International
- Message-ID: <4hn41e$2dh@druid.borland.com>
- References: <31398D95.5701DCB4@halo.tau.ac.il>
- NNTP-Posting-Host: pbecker.borland.com
- Mime-Version: 1.0
- Content-Type: Text/Plain; charset=ISO-8859-1
- X-Newsreader: WinVN 0.99.5
-
- In article <31398D95.5701DCB4@halo.tau.ac.il>, besther@halo.tau.ac.il says...
- >
- >Hi,
- >i got a problem with memory allocation, or rather deallocation.
- >i malloc() a linked list inside some function, use it i some other
- >functions and try to free() it using another funtion (all of this is in
- >borlnd c++ 3.1).
- >problem is free() doesn't free any of the memory. fter a few rounds (of
- >creating a few lists) i just ruun out of memory (malloc return a NULL).
- >i check the free memory with coreleft() and it's the same before and
- >after the call(s) to free(). i tried a simple program which allocates
- >memory using mlloc and then frees it using free() and the memmory was
- >freed (it showed in coreleft()) although i don't think it should have
- >been returned to the system, only to the free list but that doesnn't
- >realy matter.
- >
- >How do i REALY fre the memory so i can use it again?
-
- First, read the documentation for coreleft(). Calling it won't
- necessarily tell you whether a particular call to free() did anything.
- Second, assume that free() does its job. The problem is not that
- free() doesn't work, but that your program allocates memory that it never
- frees. Track through all of the memory allocations that it does, find out
- where the leaks are, and fix them. If you can't find the leaks you aren't
- looking hard enough.
-
-